<?php

class LayoutPlugin extends Zend_Controller_Plugin_Abstract
{
    /**
     * @param Zend_Controller_Request_Abstract $request
     */
    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
        $layout = Zend_Layout::getMvcInstance();
        $moduleName = $request->getModuleName();
        switch ($moduleName) {
            case 'admin':
                $controllerName = $request->getControllerName();
                switch ($controllerName) {
                    case 'index':
                        $layout->disableLayout();
                        break;
                    case 'reporter':
                        $layout->setLayout('admin/layout-reporter');
                        break;
                    default:
                        $layout->setLayout('admin/layout-admin-manage');
                        break;
                }
                break;
            case 'default':
                $layout->setLayout('layout');
                break;
        }
    }
}
